package com.woniu.his.controller;

import com.woniu.his.config.WebSocketServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
public class WebSocketController {
    @Autowired
    private WebSocketServer webSocketServer;

    @PostMapping("test")
    public void test(String shipId, String message, HttpServletResponse httpServletResponse) throws IOException {
        webSocketServer.sendTextMessage(shipId, message);
        httpServletResponse.getWriter().write("服务端接收到了消息");
    }
}
